|
1
|
|
|
export const API_URL = "http://localhost:3535/v1"; |
|
2
|
|
|
|
|
3
|
|
|
const githubAuthUrl = 'https://github.com/login/oauth/authorize'; |
|
4
|
|
|
const clientId = 'Ov23liY1kaJ2acYLtBhq'; |
|
5
|
|
|
const redirectUri = 'http://localhost:5173/github/callback'; |
|
6
|
|
|
const scope = 'user:email'; |
|
7
|
|
|
import markerIcon from '../assets/images/station.png'; |
|
8
|
|
|
import pinShadow from '../assets/images/marker-shadow.png'; |
|
9
|
|
|
import markerblack from '../assets/images/marker-icon-2x-black.png'; |
|
10
|
|
|
import markerblue from '../assets/images/marker-icon-2x-blue.png'; |
|
11
|
|
|
import markergreen from '../assets/images/marker-icon-2x-green.png'; |
|
12
|
|
|
import markergrey from '../assets/images/marker-icon-2x-grey.png'; |
|
13
|
|
|
import markerorange from '../assets/images/marker-icon-2x-orange.png'; |
|
14
|
|
|
import markerred from '../assets/images/marker-icon-2x-red.png'; |
|
15
|
|
|
import markerviolet from '../assets/images/marker-icon-2x-violet.png'; |
|
16
|
|
|
import markeryellow from '../assets/images/marker-icon-2x-yellow.png'; |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
export const GITHUB_URL = `${githubAuthUrl}?client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}`; |
|
21
|
|
|
import L from 'leaflet'; |
|
22
|
|
|
|
|
23
|
|
|
export const getHeader = (token: string, contentType?: string ) => { |
|
24
|
|
|
const config = { |
|
25
|
|
|
headers: { |
|
26
|
|
|
"Content-type" : contentType || "application/json", |
|
27
|
|
|
"Authorization": `Bearer ${token}` |
|
28
|
|
|
} |
|
29
|
|
|
} |
|
30
|
|
|
return config; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
export const iconStation = new L.Icon({ |
|
35
|
|
|
iconUrl: markerIcon, |
|
36
|
|
|
iconSize: [38, 38], // size of the icon |
|
37
|
|
|
shadowSize: [50, 64], // size of the shadow |
|
38
|
|
|
iconAnchor: [22, 94], // point of the icon which will correspond to marker's location |
|
39
|
|
|
shadowAnchor: [4, 62], // the same for the shadow |
|
40
|
|
|
popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor |
|
41
|
|
|
}); |
|
42
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
export function giveMarkerPin(index: number) { |
|
45
|
|
|
const markers = [ |
|
46
|
|
|
markeryellow, |
|
47
|
|
|
markerblack, |
|
48
|
|
|
markerblue, |
|
49
|
|
|
markergreen, |
|
50
|
|
|
markergrey, |
|
51
|
|
|
markerorange, |
|
52
|
|
|
markerred, |
|
53
|
|
|
markerviolet ] |
|
54
|
|
|
|
|
55
|
|
|
const marker = markers[index % markers.length]; |
|
56
|
|
|
|
|
57
|
|
|
return new L.Icon({ |
|
58
|
|
|
iconUrl: marker, |
|
59
|
|
|
iconSize: [25, 41], // Width and height of the icon |
|
60
|
|
|
iconAnchor: [12, 41], // The "tip" of the icon (bottom-middle) |
|
61
|
|
|
popupAnchor: [1, -34], // The point where the popup opens relative to the iconAnchor |
|
62
|
|
|
tooltipAnchor: [16, -28], // The point where the tooltip opens relative to the iconAnchor |
|
63
|
|
|
shadowSize: [41, 41], // Size of the shadow image |
|
64
|
|
|
shadowAnchor: [13, 41], |
|
65
|
|
|
}); |
|
66
|
|
|
} |